package com.hllxd.hism.star.basic.service.model.smart;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class TblSmartDqDetailEntity {
    public Long columnId;
    public Long tableId;
    public String columnName;
    public String columnNameCn;
    public String columnType;
    public String columnComment;
    public Byte action;
    public String updateTime;
    public String createTime;
    public String columnList;


    public static List<TblSmartDqDetailEntity> build(Long tableId, String columns) {
        List<TblSmartDqDetailEntity> list = new ArrayList<>();
        String[] items = columns.split(",");
        for(String it: items) {
            String[] cc = it.split("\\^");
            if (cc.length!=4) {
                continue;
            }
            TblSmartDqDetailEntity thiz = new TblSmartDqDetailEntity();
            thiz.tableId = tableId;
            thiz.columnName = cc[0];
            thiz.columnNameCn = cc[1];
            thiz.columnType = cc[2];
            thiz.columnComment = cc[3];
            list.add(thiz);
        }
        return list;
    }
}
